const utils = require('../utils')

module.exports = (ctx, version, action) => {
    console.log('#2 & #3')
    // console.log(ctx.query)
    // console.log(ctx.request.body)
    const { a, b } = utils.is_empty_object(ctx.query) ? ctx.request.body : ctx.query
    if (action == 'plus') {
        ctx.body = { ret: 1000, version, action, result: parseInt(a) + parseInt(b) }
    } else {
        ctx.body = { ret: 1000, version, action, err: 'Not support action:' + action }
    }
}